avcodec/mediacodecenc: Fix access of uninitialized value
authorZhao Zhili <zhilizhao@tencent.com>
Thu, 3 Oct 2024 17:30:57 +0000 (01:30 +0800)
committerSebastian Ramacher <sramacher@debian.org>
Sun, 27 Oct 2024 17:31:51 +0000 (18:31 +0100)
When crop is skipped, av_strlcatf will access `str` which isn't
initialized properly.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit eff9ed7bff45998ea370e3d6f627529ad47e2e74)

Gbp-Pq: Name 0004-avcodec-mediacodecenc-Fix-access-of-uninitialized-va.patch

libavcodec/mediacodecenc.c

index 6ca3968a2493453e2424a083a1a2f433e4006167..e76ea8123685381fc1120358897d63d64cc4bcf5 100644 (file)
@@ -134,7 +134,7 @@ static int extract_extradata_support(AVCodecContext *avctx)
 static int mediacodec_init_bsf(AVCodecContext *avctx)
 {
     MediaCodecEncContext *s = avctx->priv_data;
-    char str[128];
+    char str[128] = {0};
     int ret;
     int crop_right = s->width - avctx->width;
     int crop_bottom = s->height - avctx->height;